<template>
  <el-dropdown trigger="click" @command="handleCommand">
  <span class="el-dropdown-link">
    <i class="el-icon-plus cp"></i>
  </span>
    <el-dropdown-menu slot="dropdown" class="moveup20">
      <el-dropdown-item icon="el-icon-film" command="newPage">新建页面</el-dropdown-item>
      <el-dropdown-item icon="el-icon-folder-add" command="newFolder">新建文件夹</el-dropdown-item>
    </el-dropdown-menu>
  </el-dropdown>
</template>
<script>
export default {
  props: {
    id: {
      type: String
    }
  },
  name: 'PlusPageComponent',
  data () {
    return {
    }
  },
  methods: {
    handleCommand (command) {
      switch (command) {
        case 'newPage':
          this.$emit('open', {type: 'page', id: this.$props.id})
          break
        case 'newFolder':
          debugger
          this.$emit('open', {type: 'folder', id: this.$props.id})
          break
      }
    }

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>
